package com.tfswx.ocrservice.api;

import com.tfswx.ocrengine.OcrEngineUtil;
import com.tfswx.ocrengine.dto.OcrResultGetInputDTO;
import com.tfswx.ocrengine.dto.WjOcrSbjgGetOutputDTO;
import com.tfswx.ocrengine.enums.YqlxEnum;
import com.tfswx.ocrengine.executor.AbstractOcrExecutor;
import com.tfswx.ocrengine.util.Base64Util;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.lang.NonNull;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * @author Ricky
 * @date 2021/5/27
 */
@RestController
@RequestMapping("/gzgl")
@Api(tags = "ceshi")
public class TestController {
    @ApiOperation("ceshi")
    @PostMapping("/test")
    public WjOcrSbjgGetOutputDTO queryGzdyListByGzflbm() throws AbstractOcrExecutor.EngineException, IOException {
        OcrResultGetInputDTO ocrResultGetInputDTO = new OcrResultGetInputDTO();
        String base64String = Base64Util.getBase64String("E:\\Users\\Ricky\\Desktop\\pdf\\250.png");
        ocrResultGetInputDTO.setWjnr(base64String);
        ocrResultGetInputDTO.setSfwjwb(true);
        ocrResultGetInputDTO.setSfwjxx(true);

        return OcrEngineUtil.execute(YqlxEnum.XUNFEI, "192.168.7.237:8090", ocrResultGetInputDTO);
    }
}
